-
Notifications
You must be signed in to change notification settings - Fork 403
fix(typst): prevent breaking inside definition items #13978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(typst): prevent breaking inside definition items #13978
Conversation
Ensure that terms and their descriptions remain together by setting the block to be non-breakable.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Verifies that definition list terms and descriptions stay on the same page and that descriptions are indented from terms. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
I added a test using ensurePdfTextPositions. Without the fix, it reports |
cderv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I see this is added in definitions.typ and concerns Definition block which is a Pandoc blocks initially.
Would that be worth also making a PR in Pandoc for this fix to be upstream too ?
|
The terms rule is already different from Pandoc, should it be part of the PR? Edit: in fact the rule is incompatible with how Pandoc writes terms definition. #show terms: it => {
it
.children
.map(child => block(breakable: false)[
#text(weight: "bold")[#child.term]
#block(inset: (left: 1.5em, top: -0.4em))[#child.description]
])
.join()
}Question is: should we update upstream and use the above rule instead of the two? |
Ensure terms and their descriptions remain together by preventing breaks within definition items.
The rule needs to be separate from the content rule, because here we play on the implicit block generated by Typst.
As this is a visual change, there are no tests, but I believe non breaking term/definition is a sensible default.